<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="order by dede58.com"/>
    <title>修改密码</title>
    <link rel="stylesheet" type="text/css" href="css/jiazaitoubu.css">
    <link rel="stylesheet" type="text/css" href="css/css.css">
    <link rel="stylesheet" type="text/css" href="css/center.css">
    <link rel="stylesheet" type="text/css" href="css/city.css">
    <script src="js/jquery-1.8.3.min.js"></script>
    <script src="js/index2.js"></script>
    <script src="js/Popt.js"></script>
    <script src="js/cityJson.js"></script>
    <script src="js/citySet.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>

    <script src="js/common.js"></script>
</head>
<body>
<div id="app">	
<!-------------------------------------top----------------------------------->
<top></top>
<!------------------------------------导航栏------------------------>
<bar></bar>
<div class="centers_m">
<bars></bars>
        <div class="public_m1">
            <div class="public_m2">密码修改</div>
            <!--提示信息-->
            <div class="tip_notem">
                <ul>
                    <li>1.请牢记登录密码</li>
                    <li>2.如果丢失密码，可以通过绑定的手机找到</li>
                </ul>
            </div>
            <div class="public_m4">
                    <br>
                    <em><h1>手机号码：</h1></em>
                    <br>
                    <input v-model="userinfo.phone" type="text" style=" height:30px; border:1px solid #eaeaea; width:240px">
                    <br>
                    <br>
                    <em><h1>验证码：</h1></em>
                    <br>
                    <input type="text" style=" height:30px; border:1px solid #eaeaea; width:240px">
                    <input type="button" :disabled="dis" id="send" @click="click" class="btn_mfyzm" :value="message" style=" border:1px solid #c8c8c8; margin-left:12px; height:30px"/>
                    <br>
                    <br>
                    <em><h1>新的密码：</h1></em>
                    <br>
                    <input type="text" v-show="showPass" v-model="newPass" style=" height:30px; border:1px solid #eaeaea;  width:240px;  ">
                    <input type="password" v-show="!showPass" v-model="newPass" style=" height:30px; border:1px solid #eaeaea;  width:240px;  ">
                    <button type="button" v-show="!showPass"@click="showPass=!showPass">显示</button>
                    <button type="button" v-show="showPass" @click="showPass=!showPass">隐藏</button>
                    <span style="color: #ff0000">{{tishi}}</span>
                    <br>
                    <br>
                    <em><h1>确认密码：</h1></em>
                    <br>
                    <input type="text" v-show="showPas" v-model="Pass" style=" height:30px; border:1px solid #eaeaea;  width:240px;  ">
                    <input type="password" v-show="!showPas" v-model="Pass" style=" height:30px; border:1px solid #eaeaea;  width:240px;  ">
                    <button type="button" v-show="!showPas"@click="showPas=!showPas">显示</button>
                    <button type="button" v-show="showPas"@click="showPas=!showPas">隐藏</button>
                    <span style="color: #ff0000">{{tishi1}}</span>

                    <br>
                    <br>
                    <button  class="public_m3"  @click="changeSafe">确认修改</button>
            </div>
            </div>
        </div>
        <end></end>
    </div>
</body>



<script>
var app = new Vue({
    el:"#app",
    data: {

        admin: {},
        message: '点击获取验证码',
        dis:null,
        count:'60',
        showPass:false,
        showPas:false,
            userinfo: {
                id: 1,
                profile: '',
            },
        newPass:'',
        Pass:'',
        tishi:'',
        tishi1:'',





    },
        created: function () {
            this.initData(1);//初始化方法
        },

        methods: {
            //数据初始化
            initData: function (pageNum) {

                axios.post("http://localhost:8080/manage/showUserinfoType?id=1")
                    //链接数据库
                    .then(res => {
                        console.log(res.data.data);
                        this.userinfo=res.data.data;

                    });
            },
            click() {
                this.message = '重新获取' + '(' + this.count + ')' + 's'
                this.dis = 'disabled';

            },

            changeSafe(){

                axios.post("http://localhost:8080/manage/updatepass?id=1",this.userinfo)
                    .then(res=>{

                        if(this.newPass!==this.Pass)
                        {
                            alert("修改失败，两次密码不一致")
                            this.tishi='密码不一致'
                            this.tishi1='密码不一致'
                        }
                        if(this.newPass=='')
                        {
                            alert("修改失败，新密码为空")
                            this.tishi='新密码为空'
                        }
                        if(this.Pass=='')
                        {
                            alert("修改失败，确认密码为空")
                            this.tishi1='确认密码为空'
                        }
                        if(this.newPass==this.Pass&this.Pass!==''&this.Pass!=='')
                        {
                            alert("修改成功")
                            this.userinfo.pass=this.newPass;
                            this.tishi=''
                            this.tishi1=''

                        }

                    });
            },


        }
 
});

</script>
<script type="text/javascript">
            $("#city").click(function (e) {
                SelCity(this,e);
            });
        </script>

<script>
     //模拟下拉菜单的js*/
     $(".sjhcp_in span").on("mouseenter", function(e)
        {
            if($(".little_list").is(":hidden"))
            {
                $(".little_list").show();
            }
            else
            {
                $(".little_list").hide();
            }
            $(".little_list em").click(function()
            {
                var txt=$(this).text();
                $(".sjhcp_in span").text(txt);
                $(".little_list").hide();
            })
            $(document).one("click", function()
            {
                $(".little_list").hide();
            });
            e.stopPropagation();
        });
            $(".little_list").on("click", function(e)
            {
                e.stopPropagation();
            });
     
      window.onload=function()
      {
        $(".aside").css({display:"none"})
        $(".important").mouseenter(function(){
            $(".aside").css({display:"block"})
        }).mouseleave(function(){
            $(".aside").css({display:"none"})
        })
    }
       
</script>
